package com.hellobike.haxing.modules.product.entity;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hellobike.haxing.modules.product.mapper.typehandler.JSONArrayHandler;
import com.hellobike.haxing.modules.product.model.PromotionGroupNojoinSku;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Description: 活动主信息
 * @Author: haxing-boot
 * @Date: 2020-01-23
 * @Version: V1.0
 */
@Data
@TableName(value = "t_promotion", autoResultMap = true)
public class Promotion implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 活动名称
     */
    @Excel(name = "活动名称", width = 15)
    private String name;
    /**
     * 活动类型：1-拼团 2-限时抢购
     */
    @Excel(name = "活动类型：1-拼团 2-限时抢购", width = 15)
    private Integer type;
    /**
     * 活动开始时间
     */
    @Excel(name = "活动开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;
    /**
     * 活动结束时间
     */
    @Excel(name = "活动结束时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    @Excel(name = "活动预热时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date shareTime;
    /**
     * 状态：0-未启用 1-启用
     */
    @Excel(name = "状态：0-未启用 1-启用", width = 15)
    private Integer status;
    /**
     * 用户范围：0-全部 1-新用户 2-老用户
     */
    @Excel(name = "用户范围：0-全部 1-新用户 2-老用户", width = 15)
    private Integer userRange;
    /**
     * 适用范围类型：0-全部站点、1-指定站点
     */
    @Excel(name = "适用范围类型：0-全部站点、1-指定站点", width = 15)
    private Integer availableType;
    /**
     * 指定适用站点ID集合
     */
    @Excel(name = "指定适用站点ID集合", width = 15)
    @TableField(typeHandler = JSONArrayHandler.class)
    private JSONArray availableShops;
    /**
     * 创建时间
     */
    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 修改时间
     */
    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 创建人
     */
    @Excel(name = "创建人", width = 15)
    private Integer createBy;
    /**
     * 修改人
     */
    @Excel(name = "修改人", width = 15)
    private Integer updateBy;
    /**
     * 是否删除：0-否 1-是
     */
    @Excel(name = "是否删除：0-否 1-是", width = 15)
    @TableLogic
    private Integer deleted;


    @TableField(exist = false)
    private Long productId;

    @TableField(exist = false)
    private List<PromotionGroupNojoinSku> groupSkus;

}
